/*
 * @Author: 闲花落地听无声 11646503+Destiny1130@user.noreply.gitee.com
 * @Date: 2024-07-17 12:34:57
 * @LastEditors: 闲花落地听无声 11646503+Destiny1130@user.noreply.gitee.com
 * @LastEditTime: 2024-07-17 14:45:52
 * @FilePath: /job/App/setting/test/setting_test.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <pub_lib.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>

static void PrintMenu()
{
    printf("0 [FontsFile] [dwFontSize]------Set fonts detail\r\n");
    printf("1 ------------------------------Get fonts detail\r\n");
    printf("2 [1:字体;0:背景] [颜色0xRRGGBB]--Set color\r\n");
    printf("3 [1:字体;0:背景]----------------Get fonts detail\r\n");
}

int main()
{
    int cmd_id;
    int iRet;
    PrintMenu();

    while (1)
    {
        printf(">");
        scanf("%d", &cmd_id);
        switch (cmd_id)
        {
        case 0:
        {
            char cFontsFile[16];
            uint32_t dwFontSize;
            scanf("%s %d", cFontsFile, &dwFontSize);
            //printf("%s %d dwFontSize:%d cFontsFile:%s\r\n", __func__, __LINE__, dwFontSize, cFontsFile);
            iRet = PubSetFontsDetail(cFontsFile, dwFontSize);
            if(iRet){
                printf("iRet : %d\r\n", iRet);
            }else{
                printf("set fonts detail successful!\r\n");
            }
            
        }
        break;
        case 1:
        {
            char cFontsFile[16];
            uint32_t dwFontSize;
            //scanf("%s %d", cFontsFile, &dwFontSize);
            iRet = PubGetFontsDetail(cFontsFile, &dwFontSize);
            if(iRet){
                printf("iRet : %d\r\n", iRet);  
            }else{
                printf("cFontsFile:%s dwFontSize:%d\r\n",cFontsFile,dwFontSize);
            }
        }
        case 2:
        {
            int iState;
            uint32_t Color;
            scanf("%d %x", &iState, &Color);
            iRet = PubSetColor(iState,Color);
            if(iRet){
                printf("iRet : %d\r\n", iRet);  
            }else{
                printf("set color successful!\r\n");
            }
        }
        case 3:
        {
            int iState;
            uint32_t Color = 0;
            scanf("%d", &iState);
            iRet = PubGetColor(iState,&Color);
            if(iRet){
                printf("iRet : %d\r\n", iRet);  
            }else{
                printf("Color:0x%x\r\n",Color);
            }
        }
        default:
            printf("cmd_id[%d] is not supported!\r\n", cmd_id);
            break;
        }
    }
}